package socket;


import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class ForeachDemo {
    public static void main(String[] args) {
        List<String> c = Collections.synchronizedList(new ArrayList<>());
        Collections.synchronizedList(c);
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        c.add("six");

        for (String a :c) {
            System.out.println(a);
        }
        c.forEach(e->System.out.println(e));
        c.forEach(System.out::println);
    }
}
